@namespace BlazorDatasheet.Render.DefaultComponents
@using System.Globalization
@inherits BaseRenderer

<div>
    @FormattedNumber
</div>

@code {

    private string FormattedNumber
    {
        get
        {
            var parse = double.TryParse(Cell.Value.ToString(), out var num);
            if (!parse)
                return string.Empty;
            
            if (Cell?.Format == null || string.IsNullOrEmpty(Cell.Format.StringFormat))
                return num.ToString(CultureInfo.CurrentCulture);
            else
                return num.ToString(Cell.Format.StringFormat, CultureInfo.CurrentCulture);
        }
    }

    protected override void OnParametersSet()
    {
        base.OnParametersSet();
    }

}